<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<jsp:directive.page import="java.sql.*"/>

<jsp:directive.page import="Connectivity.ConnectionManager"/>
<jsp:directive.page import="net.sf.jasperreports.engine.JasperPrint"/>
<jsp:directive.page import="net.sf.jasperreports.engine.JasperFillManager"/>
<jsp:directive.page import="net.sf.jasperreports.engine.JRExporter"/>
<jsp:directive.page import="net.sf.jasperreports.engine.JRExporterParameter"/>
<jsp:directive.page import="net.sf.jasperreports.engine.JasperReport"/>
<jsp:directive.page import="net.sf.jasperreports.engine.JasperCompileManager"/>
<jsp:directive.page import="net.sf.jasperreports.engine.JasperExportManager"/>
<jsp:directive.page import="net.sf.jasperreports.view.JasperViewer"/>
<jsp:directive.page import="net.sf.jasperreports.engine.design.JasperDesign"/>
<jsp:directive.page import="net.sf.jasperreports.engine.xml.JRXmlLoader"/>
 

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<html>
  <head>
    <base href="<%=basePath%>">
    <title>My JSP 'CallPerformedReport.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	</head>

  <body>
<%   

try
	{
                    Connection con = null;
                    PreparedStatement pstmt = null;

                    ResultSet rs = null;
                    Statement stmt = null;
                    String connectionURL = "jdbc:postgresql://localhost:5431/CRM";
                    Class.forName("org.postgresql.Driver");
                    con = DriverManager.getConnection(connectionURL,"CRMUser","root");
                   // JasperReport jasperReport = null;
                  //  JasperPrint jasperPrint;
                    HashMap jasperParameter = new HashMap();

                        jasperParameter.put("p_id","30");
                    
                  //  jasperReport = JasperCompileManager.compileReport("c:\\clist.jrxml");
                  //  jasperPrint = JasperFillManager.fillReport(jasperReport,jasperParameter, con);
                 //   JasperExportManager.exportReportToPdfFile(jasperPrint, "c:\\clist.pdf");
                  //  JasperExportManager.exportReportToHtmlFile(jasperPrint, "report1.html"  );
                   // JRXlsExporter exporter = new  JRXlsExporter();
                   // exporter.setParameter(JRExportadmin   admin    erParameter.JASPER_PRINT, jasperPrint);
                   // exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "D:/hemant/DemoJasperReport/web/report1.xls"  );
                   // exporter.exportReport();
JasperDesign jasperDesign; 
JasperReport jasperReport; 
JasperPrint jasperPrint; 
jasperDesign = JRXmlLoader.load 
("report/clist.jrxml"); 
jasperReport = JasperCompileManager.compileReport(jasperDesign); 
jasperPrint = JasperFillManager.fillReport 
(jasperReport,jasperParameter,con); 

                 //   JasperViewer.viewReport(jasperPrint);

                    //response.sendRedirect("D:/hemant/DemoJasperReport/web/report1.pdf");
            
	}
	catch(Exception e)
	{e.printStackTrace();	
	System.out.println(""+e);
	}










 %>
 <br>
  </body>
</html>
